package com.whut.googleplay.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.whut.googleplay.R;
import com.whut.googleplay.application.BaseApplication;
import com.whut.googleplay.fragment.BaseFragment;
import com.whut.googleplay.utils.FragmentFactory;
import com.whut.googleplay.utils.UIUtils;


/**
 * ============================================================
 * 作 者 :        xyb
 * 版 本 :        1.0
 * 创建日期 ：     2016-04-20 下午3:11
 * 描 述 ：
 * 修订历史 ：
 * ============================================================
 **/
public class MainPageAdapter extends FragmentStatePagerAdapter {


    private String[] tab_names;

    public MainPageAdapter(FragmentManager fm) {
        super(fm);
        tab_names = UIUtils.getStringArray(R.array.tab_names);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tab_names[position];
    }

    @Override
    public Fragment getItem(int position) {
        return FragmentFactory.createFragment(position);
    }

    @Override
    public int getCount() {
        return tab_names.length;
    }



}
